import request from '@/utils/request'

// 查询企业信息列表
export function listMerchant(query) {
  return request({
    url: '/system/merchant/list',
    method: 'get',
    params: query
  })
}

// 查询企业信息详细
export function getMerchant(organizationId) {
  return request({
    url: '/system/merchant/' + organizationId,
    method: 'get'
  })
}

// 新增企业信息
export function addMerchant(data) {
  return request({
    url: '/system/merchant',
    method: 'post',
    data: data
  })
}

// 修改企业信息
export function updateMerchant(data) {
  return request({
    url: '/system/merchant',
    method: 'put',
    data: data
  })
}

// 删除企业信息
export function delMerchant(organizationId) {
  return request({
    url: '/system/merchant/' + organizationId,
    method: 'delete'
  })
}

// 删除企业信息
export function getAuthenticationUrl(organizationId) {
  return request({
    url: '/system/merchant/getAuthenticationUrl/' + organizationId,
    method: 'get'
  })
}

// 用户密码重置
export function resetUserPwd(organizationId, password) {
  const data = {
    organizationId,
    password
  }
  return request({
    url: '/system/merchant/resetPwd',
    method: 'put',
    data: data
  })
}

// 新增企业信息
export function otherAdd(data) {
  return request({
    url: '/system/merchant/otherAdd',
    method: 'post',
    data: data
  })
}


export function getOtherQuery(organizationId) {
  return request({
    url: '/system/merchant/get_other_query/' + organizationId,
    method: 'get'
  })
}

// 修改企业信息
export function otherEdit(data) {
  return request({
    url: '/system/merchant/otherEdit',
    method: 'put',
    data: data
  })
}

export function getRate(query) {
  return request({
    url: '/system/merchant/getRate/'+query,
    method: 'get',
  })
}
